class Gun:
  def __init__(self,model):
    self.model = model#型号
    self.ammo_count=0
  def add_ammo(self,count):
    self.ammo_count+=count
  def fire(self):
    if self.ammo_count<=0:
      print("No ammo,reloading!")
      return
    self.ammo_count-=1
    print("%s还剩[%d]发"%(self.model,self.ammo_count))



class soldier:
  def __init__(self,name):
    self.name = name

  def fire(self):
    if self.gun is None:
      print("[%s]没有枪"%self.name)
      return

    print("冲啊")

    self.gun.add_ammo(50)

    self.gun.fire()


Ryen=soldier("Ryen")
ak47=Gun("ak47")
Ryen.gun=ak47
Ryen.fire()